import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * User: Igor
 * Date: 30.09.13
 * Time: 21:49
 */
public class Palindrome {

    /**
     * Fields are the minimum size of the substring of palindromes
     * and ArrayList of palindromes.
     */
    private static final int MINSUBSTRING = 3;
    private static String[] palindromes = new String[100];

    public static void main(String[] args) throws IOException {
        String stringValue = inputString();
        findAllPalindrome(stringValue);
        printAllPalindromes(palindromes);
    }

    /**
     * The method to input a string in which the search for palindromes.
     */
    private static String inputString() throws IOException {
        System.out.println("Введите строку.");
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String stringValue = reader.readLine();
        return stringValue;
    }

    /**
     * The method for finding palindromes without removing whitespace.
     */
    private static void findAllPalindrome(String string){
        int counterOfPalindromes = 0;
        for (int numberOfSymbol = 0; numberOfSymbol
                < string.length(); numberOfSymbol++){
            for (int addingSymbol = numberOfSymbol + 1; addingSymbol
                    < string.length() + 1; addingSymbol++){
                String subString = string.substring(numberOfSymbol, addingSymbol);
                String revers = new StringBuilder(subString).reverse().toString();
                if ((subString.equals(revers)) && (subString.length()
                        >= MINSUBSTRING)){
                    palindromes[counterOfPalindromes] = subString;
                    counterOfPalindromes++;
                }
            }
        }
    }

    /**
     * The method for printing palindromes.
     */
    private static void printAllPalindromes(String[] array){
        for (String palindrome : array){
            if (palindrome != null){
            System.out.println(palindrome);
            }
        }
    }
}
